﻿using System.Collections.Generic;
using System.IO;
using System.Media;

namespace RRRSRoguelike.Managers
{
	/// <summary>
	/// Manages sounds in the game as well as when to play them and which ones to play.
	/// </summary>
	public class SoundManager
	{

		private Dictionary<string, SoundPlayer> sounds;

		public SoundManager()
		{
			sounds = new Dictionary<string, SoundPlayer>();
		}

		public void AddSound(string key, string path)
		{
			sounds.Add(key, new SoundPlayer());
			sounds[key].SoundLocation = path;
		}

		public void AddCustomSound(string key, string fileName)
		{
			sounds.Add(key, new SoundPlayer());
			sounds[key].SoundLocation = Path.Combine(Properties.Settings.Default.CustomFolder,
													 @"Sound\", fileName);
		}

		public void PlaySound(string sound)
		{
			if (Properties.Settings.Default.SoundToggle)
			{

				sounds[sound].Play();
			}
		}

	}
}
